<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>新闻网</title>
</head>
<body>
    <?php
        $con=mysqli_connect("localhost" ,"root","root");
        if (mysqli_connect_errno($con)) { 
            echo "连接 MySQL 失败: " . mysqli_connect_error(); 
        }
        mysqli_select_db($con, "news");
        $sql="select * from article";
        $result=mysqli_query($con, $sql);
        while($obj=mysqli_fetch_object($result)){
            echo "<ul>";
            echo "<li>";
            echo  $obj->title." ".$obj->create_time;
            echo "</li>";
            echo "</ul>";
        }
        mysqli_free_result($result);
        mysqli_close($con);
    ?>
</body>
</html>